package com.etooling.pdm.entity;


import com.etooling.framework.entity.AttachFile;
import com.etooling.framework.entity.Employee;
import com.etooling.framework.svo.AbstractEntity;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;

/**
 * 产品规格设置
 */
@Entity
@Data
@Table(name = "t_goods_specs", schema = "pdm")
public class GoodsSpecs extends AbstractEntity {
    public static String STATUS_RUNNING = "启用";
    public static String STATUS_IS_DEL = "禁用";
    public static String STATUS_IS_NEW = "新增";
    public static String STATUS_DELETE = "删除";
    public static String STATUS_IS_NO_PASS = "审核未通过";
    public static String[] STATUS = {"启用", "禁用", "新增", "审核未通过"};

    Employee creator;// 创建人
    Date createTime;// 创建时间
    Employee modifier;// 修改人
    Date lastModifiedTime; // 最后修改时间

    Goods goods;// 所属产品
    String skuCode;// sku编码
    String name;
    String specsNames;// 规格组成名称解释
    String specsValues;// 规格值
    String status;// 状态
    String memo;// 无料新增的描述,方便管理员后期维护
    String imgId;
    String imgUrl;
    String companyId;
    String specsNamesPath;// 产品属性名拼接而成
    String specsCodesPath;// 产品属性值拼接而成

    @Deprecated
    AttachFile photoFile;

    Integer stock;// 库存
    Date stockUpdateDate;// 库存更新时间


    @ManyToOne(targetEntity = Employee.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "creator_id")
    public Employee getCreator() {
        return creator;
    }


    @ManyToOne(targetEntity = Employee.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "modifier_id")
    public Employee getModifier() {
        return modifier;
    }


    @ManyToOne(targetEntity = AttachFile.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "photo_file_id")
    public AttachFile getPhotoFile() {
        return photoFile;
    }


    @ManyToOne(targetEntity = Goods.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "goods_id")
    public Goods getGoods() {
        return goods;
    }


    @Column(columnDefinition = "text")
    public String getMemo() {
        return memo;
    }


    @Deprecated
    @Transient
    String batchId;  // excel导入ID


    @Transient
    public String getBatchId() {
        return batchId;
    }

    @Transient
    public void setBatchId(String batchId) {
        this.batchId = batchId;
    }


}
